Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Unable to edit time_bound access codes #656

Conversation

mastafit
Copy link
Contributor

No description provided.

@mastafit mastafit self-assigned this Aug 26, 2024
@@ -173,7 +173,7 @@ function Content({
: null

const hasCodeInputs =
accessCode?.type !== 'time_bound' || accessCode.is_offline_access_code
accessCode?.type !== 'time_bound' && accessCode?.is_offline_access_code
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this new condition mean that the UI will only allow editing offline access codes? What about editing online access codes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mastafit I am looking at the thread, but it doesn't answer my original question. Can you answer my original question per the intent of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@razor-x You are right, I think we can add extra conditions

Copy link
Contributor Author

@mastafit mastafit Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean remove the extra condition, something like that:
const hasCodeInputs = accessCode?.type !== 'time_bound'

Copy link
Collaborator

@razor-x razor-x Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mastafit This might help.

Code inputs were intentionally hidden for offline codes: #606

But the current (and updated) logic also hides it for other code kinds. That appears like a mistake. What if we only hide the inputs when for the offline code case?

const hasCodeInputs = accessCode.is_offline_access_code !== ture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I have updated the code!

@mastafit mastafit requested a review from razor-x August 26, 2024 22:14
Comment on lines 83 to 85
if (start === null || start === undefined) {
throw new Error(`Invalid start date: ${startDate.invalidReason}`)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (start === null || start === undefined) {
throw new Error(`Invalid start date: ${startDate.invalidReason}`)
}
if (start === null) {
throw new Error(`Invalid start date: ${startDate.invalidReason}`)
}

throw new Error(`Invalid start date: ${startDate.invalidReason}`)
}

const end = endDate.toISO()
if (end == null) {
if (end === null || end === undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (end === null || end === undefined) {
if (end === null) {

Comment on lines 208 to 210
{hasCodeInputs !== null &&
hasCodeInputs !== undefined &&
hasCodeInputs && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{hasCodeInputs !== null &&
hasCodeInputs !== undefined &&
hasCodeInputs && (
{hasCodeInputs && (

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's redundant, I have removed it now

@mastafit mastafit requested a review from razor-x August 26, 2024 22:42
@razor-x razor-x changed the title The time-bound access code is not able to be edited. fix: Unable to edit time_bound access codes Aug 27, 2024
@razor-x razor-x merged commit aa838d1 into main Aug 27, 2024
16 checks passed
@razor-x razor-x deleted the andriitymofieiev/shd-178-time-bound-access-code-is-not-able-to-being-edit branch August 27, 2024 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants